package org.firebug.spring.boot.swagger;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * http://localhost:8080/spring-boot-swagger/swagger-ui.html
 */
@SpringBootApplication
@EnableSwagger2
public class SpringBootSwaggerApplication {
    public static void main(String[] args) {
        SpringApplication.run(SpringBootSwaggerApplication.class, args);
    }

    @Bean
    public Docket docket() {
        ApiInfo info = new ApiInfoBuilder()
//                .contact(new Contact("felix", "http://www.baidu.com", "178588314@qq.com"))
                .title("spring-boot-swagger")
                .version("1.0")
                .build();
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(info)
                .select()
                .apis(RequestHandlerSelectors.basePackage("org.firebug.spring.boot.swagger"))
                .paths(PathSelectors.any())
                .build();
    }
}